<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>暴力转换工具</title>
<style>
.con h2{font-size: 16px;margin: 0 0 10px;font-weight: bold;}
.con textarea{width:98.5%;min-height:100px;border: 1px solid #ddd;display: block;margin-bottom: 10px;padding: 7px;font:100 16px/22px monaco, andale mono, courier new;color: #666;border-radius: 2px;}
.con textarea:focus{outline: 0;border-color: #bbb;box-shadow: 0 0 4px rgba(0,0,0,.15)}
.con .button{display: inline-block;margin-bottom: 0;font-weight: normal;text-align: center;vertical-align: middle;cursor: pointer;background-image: none;border: 1px solid rgba(0, 0, 0, 0);white-space: nowrap;padding: 5px 12px;font-size: 12px;line-height: 1.5;border-radius: 2px;border-color: #55A5D8;background-color: #55A5D8;color: #FFF;opacity: 0.85;filter: alpha(opacity=85);}
.con .button:focus,
.con .button:hover{opacity: 1;filter: alpha(opacity=100);outline: 0;}
.con select{display: inline-block;margin-bottom: 0;font-weight: normal;text-align: center;vertical-align: middle;cursor: pointer;background-image: none;border: 1px solid rgba(0, 0, 0, 0);white-space: nowrap;padding: 5px 6px 4px;font-size: 12px;line-height: 1.5;border-radius: 2px;border-color: #ddd;}
</style>
</head>

<body>
<?php
$pid="";
if(isset($_POST['content'])){//有输入才执行	
	$pid = $_POST['content'];
	if(!empty($pid)){
		$arr = explode("\n",$pid);
		for($i=0;isset($arr[$i]);$i++){
			//$res = mb_substr($arr[$i],0,rand(1,mb_strlen($arr[$i],"UTF-8")-2),"UTF-8");
			//$res = "<tr><td><a href=\"javascript:goBuy('".$arr[$i]."');\"><img src=\"http://osstest.dg-mall.com/mall-h5/images/poster/classify2180409/zt__05.png\" width=\"100%\" /></a></td>";
			//$res = ;
			$arr_str[] = $arr[$i];
		}
		$arr_str = implode("",$arr_str);
		//print_r(nl2br($arr_str));
		//$pid = str_replace(",","','",$pid);
		//echo nl2br($pid);
	}
	
}
?>
<div id="main">
<div class="henglan" id="henglan"></div>
<div class="cbox">
<div class="head"><h1>HTML代码转换</h1></div>
<div class="con">
<h2>HTML代码</h2>
<form action="tohtml.php" method="post" name="form1">
<textarea id="content" name="content"><?php echo $pid;?></textarea>
<p class="btn">
<input type="submit" value="给我转换" class="button" />
</p><br />
</form>
<h2>转换结果</h2>
<textarea id="result"><?php echo nl2br($arr_str);?></textarea>
</div>
<div style="clear:both"></div>
</div>
</div>
</body>
</html>